﻿<cfsilent>
	<cfscript>
		
		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		stringAdvice = getProperty("serviceFactory").getBean("stringAdvice");
		
		event.setArg("pageTitle", "教师门户 - 网上评教");

		teacherId = sessionAdvice.getAutherUserID();
		
		sql = "SELECT 
					t_course_evaluate.es_id, 
					mv_running_task.institute_short, 
					mv_running_task.task_type, 
					mv_running_task.task_id, 
					mv_running_task.course_code, 
					mv_running_task.course_name, 
					mv_running_task.course_credit, 
					mv_running_task.task_week, 
					mv_running_task.tch_name, 
					mv_running_task.tch_name_sec, 
					mv_running_task.tch_name_ace 
				FROM mv_running_task 
					INNER JOIN t_course_evaluate ON t_course_evaluate.cid = mv_running_task.cid 
				WHERE 
					mv_running_task.tch_id = :teacherId 
					OR 
					mv_running_task.tch_id_sec = :teacherId 
					OR 
					mv_running_task.tch_id_ace = :teacherId ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" );

		rs_course = queryObj.execute( sql=sql ).getResult();
		
		
		/* 判断当前标签显示 */
		currentTab = event.getArg("TabID", "labQuestionnaire");
		
		passArgs = structNew();
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('DEFAULT_EVENT')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">教学活动</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 application"></i>教学质量评价
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labQuestionnaire">class="active"</cfif> id="labQuestionnaire" tabTarget="Questionnaire">网上评教的课程</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="Questionnaire" class="tabContent">
					
					<div class="noticeBlock">
						<h3>教学质量评价学生问卷</h3>
						<p><span class="img icon16x16 message"></span>下面列出的是目前与您相关的课程教学质量调查问卷, 您可以在这里查看网上评价结果.</p>
						<hr/>
					</div>
					
					<cfif rs_course.recordCount >
							
							<table class="UIEditable">
								<thead>
									<tr>
										<td width="20"></td>
										<td width="60">任课单位</td>
										<td>课程</td>
										<td width="40">学分</td>
										<td width="50">周次</td>
										<td width="20"></td>
									</tr>
								</thead>
								<tbody>
									<cfset row = 0 />
									<cfloop query="rs_course">
											
										<cfset row++ />
										
										<!--- 教师列表 --->
										<cfset teacherList = rs_course.tch_name />
										<cfif not listFind( teacherList, rs_course.tch_name_sec, "/" ) >
											<cfset teacherList = listAppend( teacherList, rs_course.tch_name_sec, "/" ) />
										</cfif>
										<cfif not listFind( teacherList, rs_course.tch_name_ace, "/" ) >
											<cfset teacherList = listAppend( teacherList, rs_course.tch_name_ace, "/" ) />
										</cfif>
										
										<cfset structInsert(passArgs, "ES", rs_course.es_id, true) />
										<cfset structInsert(passArgs, "TSK", rs_course.task_id, true) />
										<cfset structInsert(passArgs, "TT", rs_course.task_type, true) />
											
										<cfset sign = encrypt( rs_course.es_id & rs_course.task_type & rs_course.task_id, teacherId, "PBEWithMD5AndDES", "Hex" ) />
										<cfset structInsert( passArgs, "ST", sign, true ) />
										
										<tr class="editRows">
											<td class="index"><cfoutput>#row#</cfoutput></td>
											<td><cfoutput>#rs_course.institute_short#</cfoutput></td>
											<td><cfoutput>#rs_course.course_name#</cfoutput><span class="numeric"> - </span><cfoutput>#teacherList#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#numberFormat( rs_course.course_credit, "_.__" )#</cfoutput></span></td>
											<td><span class="numeric"><cfoutput>#rs_course.task_week#</cfoutput></span></td>
											<td><a class="stat details" title="查看该教学班评教结果" href="<cfoutput>#buildURL('evaluateTaskResult', passArgs)#</cfoutput>"></a></td>
										</tr>
										
									</cfloop>
								</tbody>
							</table>
							
						<cfelse>
	
							<div class="systemNotice">
								<p class="mln">看起来, 您当前学期没有评教数据.</p>
							</div>
						
					</cfif>
					
				</div>
			
			</div>
		</li>
	</ul>
</div>